inspector: Save some more space
authorMatthias Clasen <mclasen@redhat.com>
Fri, 10 Oct 2014 20:06:37 +0000 (16:06 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 11 Oct 2014 04:59:36 +0000 (00:59 -0400)
Instead of nesting two notebooks, use a stack switcher in
the headerbar for the outer notebook. This saves valuable
vertical space.

gtk/inspector/inspect-button.c
gtk/inspector/window.c
gtk/inspector/window.h
gtk/inspector/window.ui

index 96255ccdcb35d01b14a8513a541798535662976c..dca645e1fb2e3bbe7f73f4f4c38dd583c81f928f 100644 (file)
@@ -27,7 +27,7 @@
 #include "window.h"
 #include "widget-tree.h"
 
-#include "gtknotebook.h"
+#include "gtkstack.h"
 #include "gtkmain.h"
 
 typedef struct
@@ -213,7 +213,7 @@ select_widget (GtkInspectorWindow *iw,
 
   iw->selected_widget = widget;
 
-  gtk_notebook_set_current_page (GTK_NOTEBOOK (iw->top_notebook), 0);
+  gtk_stack_set_visible_child_name (GTK_STACK (iw->top_stack), "objects");
 
   if (!gtk_inspector_widget_tree_find_object (wt, G_OBJECT (widget), &iter))
     gtk_inspector_widget_tree_scan (wt, gtk_widget_get_toplevel (widget));
index 8a8a27ca1280a12a7b2f60ef3759421c10ef16c5..aca96761beabbc02e675414d142646353c0cc51b 100644 (file)
@@ -132,16 +132,10 @@ on_send_widget_to_shell_activate (GtkWidget          *menuitem,
 static void
 gtk_inspector_window_init (GtkInspectorWindow *iw)
 {
-  gchar *title;
-
   gtk_widget_init_template (GTK_WIDGET (iw));
 
   gtk_window_group_add_window (gtk_window_group_new (), GTK_WINDOW (iw));
 
-  title = g_strdup_printf (_("GTK+ Inspector — %s"), g_get_application_name ());
-  gtk_window_set_title (GTK_WINDOW (iw), title);
-  g_free (title);
-
   if (gtk_inspector_python_is_enabled ())
     {
       gtk_widget_show (iw->python_shell);
@@ -170,7 +164,7 @@ gtk_inspector_window_class_init (GtkInspectorWindowClass *klass)
 
   gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/window.ui");
 
-  gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, top_notebook);
+  gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, top_stack);
   gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, widget_tree);
   gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, prop_list);
   gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, child_prop_list);
index c9fec99e3cccfd82ace39cf196eaf536fa04ab4d..ce6fe16a39e82f3ec5f6d4b6a27e7c99a92c70a7 100644 (file)
@@ -41,7 +41,7 @@ typedef struct
 {
   GtkWindow parent;
 
-  GtkWidget *top_notebook;
+  GtkWidget *top_stack;
   GtkWidget *widget_tree;
   GtkWidget *prop_list;
   GtkWidget *child_prop_list;
index 35cb17bd6f0c8d54f2c7e8fb26f28e154738beac..50b611ddd7355ffa0fd507b6057f87c39f3831b3 100644 (file)
             <property name="pack-type">start</property>
           </packing>
         </child>
+        <child type="title">
+          <object class="GtkStackSwitcher">
+            <property name="visible">True</property>
+            <property name="stack">top_stack</property>
+          </object>
+        </child>
       </object>
     </child>
     <child>
-      <object class="GtkNotebook" id="top_notebook">
+      <object class="GtkStack" id="top_stack">
         <property name="visible">True</property>
-        <property name="show-border">False</property>
         <child>
           <object class="GtkBox">
             <property name="visible">True</property>
             </child>
           </object>
           <packing>
-            <property name="tab_expand">True</property>
-            <property name="tab_fill">True</property>
+            <property name="name">objects</property>
+            <property name="title" translatable="yes">Objects</property>
           </packing>
         </child>
-        <child type="tab">
-          <object class="GtkLabel">
-            <property name="visible">True</property>
-            <property name="label" translatable="yes">Objects</property>
-          </object>
-        </child>
         <child>
           <object class="GtkInspectorResourceList">
             <property name="visible">True</property>
           </object>
           <packing>
-            <property name="tab_expand">True</property>
-            <property name="tab_fill">True</property>
+            <property name="name">resources</property>
+            <property name="title" translatable="yes">Resources</property>
           </packing>
         </child>
-        <child type="tab">
-          <object class="GtkLabel">
-            <property name="visible">True</property>
-            <property name="label" translatable="yes">Resources</property>
-          </object>
-        </child>
         <child>
           <object class="GtkInspectorCssEditor">
             <property name="visible">True</property>
             <property name="global">True</property>
           </object>
           <packing>
-            <property name="tab_expand">True</property>
-            <property name="tab_fill">True</property>
+            <property name="name">css</property>
+            <property name="title" translatable="yes">Custom CSS</property>
           </packing>
         </child>
-        <child type="tab">
-          <object class="GtkLabel">
-            <property name="visible">True</property>
-            <property name="label" translatable="yes">Custom CSS</property>
-          </object>
-        </child>
         <child>
           <object class="GtkInspectorVisual">
             <property name="visible">True</property>
           </object>
           <packing>
-            <property name="tab_expand">True</property>
-            <property name="tab_fill">True</property>
+            <property name="name">visual</property>
+            <property name="title" translatable="yes">Visual</property>
           </packing>
         </child>
-        <child type="tab">
-          <object class="GtkLabel">
-            <property name="visible">True</property>
-            <property name="label" translatable="yes">Visual</property>
-          </object>
-        </child>
         <child>
           <object class="GtkInspectorGeneral">
             <property name="visible">True</property>
           </object>
           <packing>
-            <property name="tab_expand">True</property>
-            <property name="tab_fill">True</property>
+            <property name="name">general</property>
+            <property name="title" translatable="yes">General</property>
           </packing>
         </child>
-        <child type="tab">
-          <object class="GtkLabel">
-            <property name="visible">True</property>
-            <property name="label" translatable="yes">General</property>
-          </object>
-        </child>
       </object>
     </child>
   </template>